<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>show</title>
</head>
<body>
    <div>
        <label>资讯类型</label>
        <input id="type" type="text" width="20" height="20">
        <button onclick="select()">查询</button>
        <a href="/Info">增加资询</a>
    </div>
    <div>
        <div id="show"></div>
    </div>
</body>
</html>
<script type="text/javascript" src="js/1.8.2.min.js"></script>
<script>
    function select() {
        var type = $("#type").val();
        var  usedata = {};
        usedata['type']= type;
        // 使用AJAX提交数据
        $.ajax({
            type: "POST",
            contentType: "application/json",
            url: "/Release/select",
            data: JSON.stringify(usedata) ,
            success: function (lists) {
                var inf  = '<table>';
                inf += '<th><td>ID</td><td>标题</td></th>';
                /*<![CDADA[*/
                for ( var i = 0 ; i < lists.length; i++){
                    /*]]>*/
                    var list = lists[i];
                    inf += '<tr><td>'+list.id+'</td><td>'+list.title+'</td><td><button onclick="delect('+list.id+')">删除</button></td></tr>';
                }
                inf += '</table>';
                $("#show").html(inf);
            }
        });
    }
    function delect(id1) {
        // 使用AJAX提交数据
        $.ajax({
            type: "POST",
            contentType: "application/json",
            url: "/Release/delect",
            data: JSON.stringify({id:id1}) ,
            success: function (lists) {
                var inf  = '<table>';
                inf += '<th><td>ID</td><td>标题</td></th>';
                /*<![CDADA[*/
                for ( var i = 0 ; i < lists.length; i++){
                    /*]]>*/
                    var list = lists[i];
                    inf += '<tr><td>'+list.id+'</td><td>'+list.title+'</td><td><button >删除</button></td></tr>';
                }
                inf += '</table>';
                $("#show").html(inf);
            }
        });
    }

</script>